<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
        // 1.将A5F3转成2进制
            // var a = 'A5F3'
            // var a2 = parseInt(a,16)
            // var a3 = a2.toString(2)

            // console.log(a3);

        // 2.99乘法表
        // for (let i = 1; i <= 9; i++) {
        //     for (let j = 1; j <= i; j++) {  
        //         document.write(i + '*' + j + '=' +i*j + '&nbsp');
                
        //     }
        //     document.write('<br>');
            
        // }

        // 3.输入年月，（用数组）
        // 3.1.计算当月有多少天
        // 3.2.计算还剩多少天
        var arr = [prompt('请输入年'),prompt('请输入月'),prompt('请输入日')]

        if (arr[0] % 4 == 0 && arr[0] % 100 != 0 || arr[0] % 400 == 0) {
                    var sum = 366
                }else{
                    var sum = 365
                }

            switch (arr[1]) {
            case '1':
            case '3':
            case '5':
            case '7':
            case '8':
            case '10':
            case '12':
                document.write(arr[1] + '月有31天,本月还剩' + (31-arr[2]) + '天，本年还剩' )
                break;

                case '2': 
                if (arr[0] % 4 == 0 && arr[0] % 100 != 0 || arr[0] % 400 == 0) {
                document.write(arr[1] + '月有29天,本月还剩' + (29-arr[2]) + '天，本年还剩' )
                break;
                }else{
                document.write(arr[1] + '月有28天,本月还剩' + (28-arr[2]) + '天，本年还剩' )
                break;
                }
            
                case '4':
                case '6':
                case '9':
                case '11':
                document.write(arr[1] + '月有30天' + (30-arr[2]) + '天' )
                break;
            default:
                break;
        }
        if (sum == 365) {
            switch (arr[1]) {
                case '1':
                document.write('本年还剩' + (365 - arr[2]))
                    break;
                case '2':
                document.write('本年还剩' + (365 - 31 - arr[2]))
                    break;
                case '3':
                document.write('本年还剩' + (365 - 59 - arr[2]))
                    break;
                case '4':
                document.write('本年还剩' + (365 - 90 - arr[2]))
                    break;
                case '5':
                document.write('本年还剩' + (365 - 120 - arr[2]))
                    break;
                case '6':
                document.write('本年还剩' + (365 - 151 - arr[2]))
                    break;
                case '7':
                document.write('本年还剩' + (365 - 181 - arr[2]))
                    break;
                case '8':
                document.write('本年还剩' + (365 - 212 - arr[2]))
                    break;
                case '9':
                document.write('本年还剩' + (365 - 243 - arr[2]))
                    break;
                case '10':
                document.write('本年还剩' + (365 - 273 - arr[2]))
                    break;
                case '11':
                document.write('本年还剩' + (365 - 304 - arr[2]))
                    break;
                case '12':
                document.write('本年还剩' + (365 - 334 - arr[2]))
                    break;
                default:
                    break;
            }
        }else if (sum == 366){
            switch (arr[1]) {
                case '1':
                document.write('本年还剩' + (366 - arr[2]))
                    break;
                case '2':
                document.write('本年还剩' + (366 - 31 - arr[2]))
                    break;
                case '3':
                document.write('本年还剩' + (366 - 60 - arr[2]))
                    break;
                case '4':
                document.write('本年还剩' + (366 - 91 - arr[2]))
                    break;
                case '5':
                document.write('本年还剩' + (366 - 121 - arr[2]))
                    break;
                case '6':
                document.write('本年还剩' + (366 - 152 - arr[2]))
                    break;
                case '7':
                document.write('本年还剩' + (366 - 182 - arr[2]))
                    break;
                case '8':
                document.write('本年还剩' + (366 - 213 - arr[2]))
                    break;
                case '9':
                document.write('本年还剩' + (366 - 244 - arr[2]))
                    break;
                case '10':
                document.write('本年还剩' + (366 - 274 - arr[2]))
                    break;
                case '11':
                document.write('本年还剩' + (366 - 305 - arr[2]))
                    break;
                case '12':
                document.write('本年还剩' + (366 - 335 - arr[2]))
                    break;
                default:
                    break;
            }
        }
        
        

    </script>
    
</body>
</html>